/*
 * TestServer.cpp
 *
 *  Created on: 2010-12-15
 *      Author: Xairy
 */

#include "TestServer.h"
#include "Client.h"

#include "TTracer.h"

void TestServer::setUp()
{
    iSession.ConnectL();
}

void TestServer::tearDown()
{
    iSession.Close();
}

_LIT(KServerStackName, "TestServerStack");
_LIT(KCall, "This is a call");

TBool FindChunk(const TDesC& aChunkName)
{
    TFindChunk chunkClose;
    chunkClose.Find(aChunkName);
    TFullName name;
    TInt code = chunkClose.Next(name);
    return (code == KErrNone);
}

void TestServer::testServer()
{
    iSession.CreateCallStack(KServerStackName);
    TS_ASSERT(FindChunk(KServerStackName));
    TS_ASSERT(iSession.Stack().IsAvaliable());
    TS_ASSERT(iSession.Stack().isEmpty());
    
    TRAPD(err, User::Leave(10));
    
    iSession.Close();
    TS_ASSERT(! iSession.Stack().IsAvaliable());
    TS_ASSERT(! FindChunk(KServerStackName));
}


